<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta charset="utf-8" />
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="MobileOptimized" content="320" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title></title>
		<link rel="stylesheet" href="css/style.css" />
	</head>

	<body>

		<div id="lottery">
			<table border="0" cellpadding="0" cellspacing="0">
				<tr class="lottery-group">
					<td><span class="lottery-unit"><img src="images/1.png" /></span></td>
					<td><span class="lottery-unit" data-name="nimei1"><img src="images/2.png" /></span></td>
					<td><span class="lottery-unit" data-name="nimei2"><img src="images/4.png" /></span></td>
					<td><span class="lottery-unit"><img src="images/3.png" /></span></td>
				</tr>
				<tr class="lottery-group">
					<td><span class="lottery-unit"><img src="images/7.png" /></span></td>
					<td colspan="2" rowspan="2">
						<a class="run" id="run"></a>
					</td>
					<td><span class="lottery-unit"><img src="images/5.png" /></span></td>
				</tr>
				<tr class="lottery-group">
					<td><span class="lottery-unit"><img src="images/1.png" /></span></td>
					<td><span class="lottery-unit"><img src="images/6.png" /></span></td>
				</tr>
				<tr class="lottery-group">
					<td><span class="lottery-unit"><img src="images/3.png" /></span></td>
					<td><span class="lottery-unit"><img src="images/6.png" /></span></td>
					<td><span class="lottery-unit"><img src="images/8.png" /></span></td>
					<td><span class="lottery-unit"><img src="images/7.png" /></span></td>
				</tr>
			</table>
		</div>
		<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="js/lottery.js"></script>
		<script type="text/javascript">
			window.onload = function() {
				lottery.lottery({
					selector: '#lottery',
					width: 4,
					height: 4,
					index: 0, // 初始位置
					initSpeed: 500, // 初始转动速度
					// upStep:       50,   // 加速滚动步长
					// upMax:        50,   // 速度上限
					// downStep:     30,   // 减速滚动步长
					// downMax:      500,  // 减速上限
					// waiting:      5000, // 匀速转动时长
					beforeRoll: function() { // 重写滚动前事件：beforeRoll
						// console.log(this);
						// alert(1);
					},
					beforeDown: function() { // 重写减速前事件：beforeDown
						// console.log(this);
						// alert(1);
					},
					endfn: function() {
						console.log("333");
						var msg = "感谢您的参与！";
						if (this._index() == this.options.target) {
							msg = "您抽中的是" + $(".active").attr("data-name");
						}
						console.log(msg);
					},

					aim: function() { // 重写计算中奖号的方法：aim
						console.log(this);
						this.options.target = 1;
					}
				});
			}
		</script>
	</body>

</html>